/*
 * LoginUserInfoBO.java 
 * 
 * Copyright 2009 Wangfeng Beijing Inc. 
 * All rights reserved. 
 * 
 * Created on 2012-07-31
 */

package com.bjtech.domain.query;

import org.ssi.web.util.QuerySpecTpl;

import com.bjtech.web.util.SelectBean;

/**
 * 功能概述:登陆用户管理 <br>
 * 
 * @author 王峰
 */

public class LoginUserInfoQuerySpec extends SelectBean {
	/* */
	private Long id;
	/* */
	private String user_name;
	/* */
	private String pass_word;
	/* */
	private String real_name;
	/* */
	private String tel;
	/* */
	private Long room_id;
	/* */
	private Long user_role;
	/* */
	private Long build_id;
	/* */
	private Long share_area_id;
	/* */
	private Long proj_id;

	@Override
	public void queryParamString() {
		StringBuilder fromPart = new StringBuilder(" where user_name!='admin' ");

		if (this.isAll != null && this.isAll.intValue() != 1) {
			if (QuerySpecTpl.isValid(id)) {
				fromPart.append(" and a.id = ");
				fromPart.append(id);
			}

			if (QuerySpecTpl.isValid(user_name)) {
				fromPart.append(" and a.user_name like ");
				fromPart.append(" CONCAT('%','");
				fromPart.append(user_name);
				fromPart.append("','%')");
			}

			if (QuerySpecTpl.isValid(pass_word)) {
				fromPart.append(" and a.pass_word like ");
				fromPart.append(" CONCAT('%','");
				fromPart.append(pass_word);
				fromPart.append("','%')");
			}

			if (QuerySpecTpl.isValid(real_name)) {
				fromPart.append(" and a.real_name like ");
				fromPart.append(" CONCAT('%','");
				fromPart.append(real_name);
				fromPart.append("','%')");
			}

			if (QuerySpecTpl.isValid(tel)) {
				fromPart.append(" and a.tel like ");
				fromPart.append(" CONCAT('%','");
				fromPart.append(tel);
				fromPart.append("','%')");
			}

			if (QuerySpecTpl.isValid(room_id)) {
				fromPart.append(" and a.room_id = ");
				fromPart.append(room_id);
			}

			if (QuerySpecTpl.isValid(user_role)) {
				fromPart.append(" and a.user_role = ");
				fromPart.append(user_role);
			}

			if (QuerySpecTpl.isValid(build_id)) {
				fromPart.append(" and a.build_id = ");
				fromPart.append(build_id);
			}

			if (QuerySpecTpl.isValid(share_area_id)) {
				fromPart.append(" and a.share_area_id = ");
				fromPart.append(share_area_id);
			}

			if (QuerySpecTpl.isValid(proj_id)) {
				fromPart.append(" and a.proj_id = ");
				fromPart.append(proj_id);
			}

			if (QuerySpecTpl.isValid(this.direction)
					&& QuerySpecTpl.isValid(this.sort)) {
				fromPart.append(" order by ");
				fromPart.append(this.sort);
				fromPart.append(" ");
				fromPart.append(this.direction);
			} else {
				fromPart.append(" order by ");
				fromPart.append("id");
				fromPart.append(" ");
				fromPart.append("asc");

			}
		}
		super.setQueryString(fromPart.toString());
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUser_name() {
		return this.user_name;
	}

	public void setUser_name(String user_name) {
		this.user_name = user_name;
	}

	public String getPass_word() {
		return this.pass_word;
	}

	public void setPass_word(String pass_word) {
		this.pass_word = pass_word;
	}

	public String getReal_name() {
		return this.real_name;
	}

	public void setReal_name(String real_name) {
		this.real_name = real_name;
	}

	public String getTel() {
		return this.tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public Long getRoom_id() {
		return this.room_id;
	}

	public void setRoom_id(Long room_id) {
		this.room_id = room_id;
	}

	public Long getUser_role() {
		return this.user_role;
	}

	public void setUser_role(Long user_role) {
		this.user_role = user_role;
	}

	public Long getBuild_id() {
		return this.build_id;
	}

	public void setBuild_id(Long build_id) {
		this.build_id = build_id;
	}

	public Long getShare_area_id() {
		return this.share_area_id;
	}

	public void setShare_area_id(Long share_area_id) {
		this.share_area_id = share_area_id;
	}

	public Long getProj_id() {
		return this.proj_id;
	}

	public void setProj_id(Long proj_id) {
		this.proj_id = proj_id;
	}
}
